﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OnlineMovieTicket.Services.IServices;
using OnlineMovieTicket.Data.IRepository;
using OnlineMovieTicket.Data.Repository;
using OnlineMovieTicket.Model;

namespace OnlineMovieTicket.Services.Services
{
    public class MoviesService : IMoviesService
    {
        IMoviesRepository dataRepo;

        public MoviesService()
        {
            dataRepo = new MoviesRepository();
        }
    
        public IList<Movies>  GetMovies()
        {
            return dataRepo.GetMovies();
        }

        public IList<Movies> GetNowShowingMovies()
        {
            return dataRepo.GetMovies("N");
        }

        public IList<Movies> GetCommingSoonMovies()
        {
            return dataRepo.GetMovies("C");
        }

        public Movies GetMovie(int MovieCode)
        {
            return dataRepo.GetMovie(MovieCode);
        }

        public IList<Movies> GetMovieByRating()
        {           
            return dataRepo.GetMoviesByRating();          
        } 

        public void Save(Movies movie,int mode)
        {
            dataRepo.Save(movie,mode);
        }

        public bool Delete(int movieCode)
        {
            return dataRepo.Delete(movieCode);
        }

        public int GetNewMovieCode()
        {
            return dataRepo.GetNewMovieCode();
        }
    }
}
